package com.xyrl.third.aliyun.enu;

/**
 * oss 附件上传 文件类型枚举类
 *
 * @author zhongp
 * @version 1.0
 * @className EContentType
 * @company 星纭融链科技服务有限公司
 * @date 2019-12-27 14:17:35
 * @Description
 */
public enum EContentType {
    /**
     * apk
     */
    apk("apk", "application/vnd.android.package-archive"),
    /***
     * 3gp
     */
    _3gp("3gp", "video/3gpp"),
    /***
     * ai
     */
    ai("ai", "application/postscript"),
    /***
     * aif
     */
    aif("aif", "audio/x-aiff"),
    /***
     * aifc
     */
    aifc("aifc", "audio/x-aiff"),
    /***
     * aiff
     */
    aiff("aiff", "audio/x-aiff"),
    /***
     * asc
     */
    asc("asc", "text/plain"),
    /**
     * atom
     */
    atom("atom", "application/atom+xml"),
    /**
     * au
     */
    au("au", "audio/basic"),
    /***
     * avi
     */
    avi("avi", "video/x-msvideo"),
    /**
     * bcpio
     */
    bcpio("bcpio", "application/x-bcpio"),
    /**
     * bin
     */
    bin("bin", "application/octet-stream"),
    /**
     * bmp
     */
    bmp("bmp", "image/bmp"),
    /**
     * cdf
     */
    cdf("cdf", "application/x-netcdf"),
    /**
     * cgm
     */
    cgm("cgm", "image/cgm"),
    /**
     * class
     */
    classs("class", "application/octet-stream"),
    /***
     * cpio
     */
    cpio("cpio", "application/x-cpio"),
    /***
     * cpt
     */
    cpt("cpt", "application/mac-compactpro"),
    /**
     * csh
     */
    csh("csh", "application/x-csh"),
    /**
     * css
     */
    css("css", "text/css"),
    dcr("dcr", "application/x-director"),
    dif("dif", "video/x-dv"),
    dir("dir", "application/x-director"),
    djv("djv", "image/vnd.djvu"),
    djvu("djvu", "image/vnd.djvu"),
    dll("dll", "application/octet-stream"),
    dmg("dmg", "application/octet-stream"),
    dms("dms", "application/octet-stream"),
    /**
     * doc
     */
    doc("doc", "application/msword"),
    /**
     * dtd
     */
    dtd("dtd", "application/xml-dtd"),
    /**
     * dv
     */
    dv("dv", "video/x-dv"),
    /**
     * dvi
     */
    dvi("dvi", "application/x-dvi"),
    /**
     * dxr
     */
    dxr("dxr", "application/x-director"),
    /**
     * epse
     */
    eps("eps", "application/postscript"),
    /**
     * etx
     */
    etx("etx", "text/x-setext"),
    /**
     * exe
     */
    exe("exe", "application/octet-stream"),
    /**
     * ez
     */
    ez("ez", "application/andrew-inset"),
    /**
     * flv
     */
    flv("flv", "video/x-flv"),
    /**
     * gif
     */
    gif("gif", "image/gif"),
    /**
     * gram
     */
    gram("gram", "application/srgs"),
    /**
     * grxml
     */
    grxml("grxml", "application/srgs+xml"),
    /**
     * gtar
     */
    gtar("gtar", "application/x-gtar"),
    /**
     *
     */
    gz("gz", "application/x-gzip"),
    /**
     * gz
     */
    hdf("hdf", "application/x-hdf"),
    /**
     * hqx
     */
    hqx("hqx", "application/mac-binhex40"),
    /**
     * htm
     */
    htm("htm", "text/html"),
    /**
     * html
     */
    html("html", "text/html"),
    /**
     * ice
     */
    ice("ice", "x-conference/x-cooltalk"),
    /**
     * ico
     */
    ico("ico", "image/x-icon"),
    /**
     * ics
     */
    ics("ics", "text/calendar"),
    /**
     * ief
     */
    ief("ief", "image/ief"),
    /**
     * ifb
     */
    ifb("ifb", "text/calendar"),
    /**
     * iges
     */
    iges("iges", "model/iges"),
    /**
     * igs
     */
    igs("igs", "model/iges"),
    /**
     * jnlp
     */
    jnlp("jnlp", "application/x-java-jnlp-file"),
    /**
     * jp2
     */
    jp2("jp2", "image/jp2"),
    /**
     * jpe
     */
    jpe("jpe", "image/jpeg"),
    /**
     * jpeg
     */
    jpeg("jpeg", "image/jpeg"),
    /**
     * jpg
     */
    jpg("jpg", "image/jpeg"),
    js("js", "application/x-javascript"),
    kar("kar", "audio/midi"),
    latex("latex", "application/x-latex"),
    lha("lha", "application/octet-stream"),
    lzh("lzh", "application/octet-stream"),
    m3u("m3u", "audio/x-mpegurl"),
    m4a("m4a", "audio/mp4a-latm"),
    m4p("m4p", "audio/mp4a-latm"),
    m4u("m4u", "video/vnd.mpegurl"),
    m4v("m4v", "video/x-m4v"),
    mac("mac", "image/x-macpaint"),
    man("man", "application/x-troff-man"),
    mathml("mathml", "application/mathml+xml"),
    me("me", "application/x-troff-me"),
    mesh("mesh", "model/mesh"),
    mid("mid", "audio/midi"),
    midi("midi", "audio/midi"),
    mif("mif", "application/vnd.mif"),
    mov("mov", "video/quicktime"),
    movie("movie", "video/x-sgi-movie"),
    mp2("mp2", "audio/mpeg"),
    mp3("mp3", "audio/mpeg"),
    mp4("mp4", "video/mp4"),
    mpe("mpe", "video/mpeg"),
    mpeg("mpeg", "video/mpeg"),
    mpg("mpg", "video/mpeg"),
    mpga("mpga", "audio/mpeg"),
    ms("ms", "application/x-troff-ms"),
    msh("msh", "model/mesh"),
    mxu("mxu", "video/vnd.mpegurl"),
    nc("nc", "application/x-netcdf"),
    oda("oda", "application/oda"),
    ogg("ogg", "application/ogg"),
    ogv("ogv", "video/ogv"),
    pbm("pbm", "image/x-portable-bitmap"),
    pct("pct", "image/pict"),
    pdb("pdb", "chemical/x-pdb"),
    pdf("pdf", "application/pdf"),
    pgm("pgm", "image/x-portable-graymap"),
    pgn("pgn", "application/x-chess-pgn"),
    pic("pic", "image/pict"),
    pict("pict", "image/pict"),
    png("png", "image/png"),
    pnm("pnm", "image/x-portable-anymap"),
    pnt("pnt", "image/x-macpaint"),
    pntg("pntg", "image/x-macpaint"),
    ppm("ppm", "image/x-portable-pixmap"),
    ppt("ppt", "application/vnd.ms-powerpoint"),
    ps("ps", "application/postscript"),
    qt("qt", "video/quicktime"),
    qti("qti", "image/x-quicktime"),
    qtif("qtif", "image/x-quicktime"),
    ra("ra", "audio/x-pn-realaudio"),
    ram("ram", "audio/x-pn-realaudio"),
    ras("ras", "image/x-cmu-raster"),
    rdf("rdf", "application/rdf+xml"),
    rgb("rgb", "image/x-rgb"),
    rm("rm", "application/vnd.rn-realmedia"),
    roff("roff", "application/x-troff"),
    rtf("rtf", "text/rtf"),
    rtx("rtx", "text/richtext"),
    sgm("sgm", "text/sgml"),
    sgml("sgml", "text/sgml"),
    sh("sh", "application/x-sh"),
    shar("shar", "application/x-shar"),
    silo("silo", "model/mesh"),
    sit("sit", "application/x-stuffit"),
    skd("skd", "application/x-koan"),
    skm("skm", "application/x-koan"),
    skp("skp", "application/x-koan"),
    skt("skt", "application/x-koan"),
    smi("smi", "application/smil"),
    smil("smil", "application/smil"),
    snd("snd", "audio/basic"),
    so("so", "application/octet-stream"),
    spl("spl", "application/x-futuresplash"),
    src("src", "application/x-wais-source"),
    sv4cpio("sv4cpio", "application/x-sv4cpio"),
    sv4crc("sv4crc", "application/x-sv4crc"),
    svg("svg", "image/svg+xml"),
    swf("swf", "application/x-shockwave-flash"),
    t("t", "application/x-troff"),
    tar("tar", "application/x-tar"),
    tcl("tcl", "application/x-tcl"),
    tex("tex", "application/x-tex"),
    texi("texi", "application/x-texinfo"),
    texinfo("texinfo", "application/x-texinfo"),
    tif("tif", "image/tiff"),
    tiff("tiff", "image/tiff"),
    tr("tr", "application/x-troff"),
    tsv("tsv", "text/tab-separated-values"),
    txt("txt", "text/plain"),
    ustar("ustar", "application/x-ustar"),
    vcd("vcd", "application/x-cdlink"),
    vrml("vrml", "model/vrml"),
    vxml("vxml", "application/voicexml+xml"),
    wav("wav", "audio/x-wav"),
    wbmp("wbmp", "image/vnd.wap.wbmp"),
    wbxml("wbxml", "application/vnd.wap.wbxml"),
    webm("webm", "video/webm"),
    wml("wml", "text/vnd.wap.wml"),
    wmlc("wmlc", "application/vnd.wap.wmlc"),
    wmls("wmls", "text/vnd.wap.wmlscript"),
    /**
     * wmlsc
     */
    wmlsc("wmlsc", "application/vnd.wap.wmlscriptc"),
    /**
     * wmv
     */
    wmv("wmv", "video/x-ms-wmv"),
    /**
     * wrl
     */
    wrl("wrl", "model/vrml"),
    /**
     * xbm
     */
    xbm("xbm", "image/x-xbitmap"),
    /**
     * xht
     */
    xht("xht", "application/xhtml+xml"),
    /**
     * xthml
     */
    xhtml("xhtml", "application/xhtml+xml"),
    /**
     * xls
     */
    xls("xls", "application/vnd.ms-excel"),
    /**
     * xml
     */
    xml("xml", "application/xml"),
    /**
     * xpm
     */
    xpm("xpm", "image/x-xpixmap"),
    /**
     * xsl
     */
    xsl("xsl", "application/xml"),
    /**
     * xslt
     */
    xslt("xslt", "application/xslt+xml"),
    /**
     * xul
     */
    xul("xul", "application/vnd.mozilla.xul+xml"),
    /**
     * xwd
     */
    xwd("xwd", "image/x-xwindowdump"),
    /**
     * xyz
     */
    xyz("xyz", "chemical/x-xyz"),
    /**
     * zip
     */
    zip("zip", "application/zip");
    private String key;

    private String type;

    EContentType(String key, String type) {
        this.key = key;
        this.type = type;
    }

    public String getKey() {
        return key;
    }

    public String getType() {
        return type;
    }

    /**
     * 根据后缀名获取相关的centent-type类型
     *
     * @param key
     * @author zhongp
     * @date 2019-12-27 14:19:42
     */
    public static String getType(String key) {
        EContentType[] array = EContentType.values();
        for (EContentType e : array) {
            if (e.getKey().equals(key)) {
                return e.getType();
            }
        }
        return null;
    }


    /**
     * 根据后缀名获取相关的centent-type对象
     *
     * @param key
     * @author zhongp
     * @date 2019-12-27 14:20:43
     */
    public static EContentType getObject(String key) {
        EContentType[] array = EContentType.values();
        for (EContentType e : array) {
            if (e.getKey().equals(key)) {
                return e;
            }
        }
        return null;
    }

}
